package com.generator.demo.common.pageHelp;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * @author pcy
 * @Date 2021/8/19 17:11
 * @Created by pcy
 * @Description TODO
 */
public class PageQuery<T> {
    /**
     * 总数
     */
    @TableField(select = false)
    private long total = 0;
    /**
     * 每页显示条数，默认 10
     */
    @TableField(select = false)
    private long pageSize = 10;
    /**
     * 当前页
     */
    @TableField(select = false)
    private long pageNo = 1;

    public static <T> Page<T> withPage(PageQuery<T> pageQuery) {
        return new Page<T>(pageQuery.getPageNo(), pageQuery.getPageSize());
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getPageSize() {
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public long getPageNo() {
        return pageNo;
    }

    public void setPageNo(long pageNo) {
        this.pageNo = pageNo;
    }
}
